package com.example.dryyzx.dao;

import com.example.dryyzx.entity.CustomerDiet;
import org.apache.ibatis.jdbc.SQL;

public class CustomerDietSqlProvider {
    public String insertSelective(CustomerDiet record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("customer_diet");
        
        if (record.getCustomerId() != null) {
            sql.VALUES("customer_id", "#{customerId,jdbcType=INTEGER}");
        }
        
        if (record.getLoving() != null) {
            sql.VALUES("loving", "#{loving,jdbcType=VARCHAR}");
        }
        
        if (record.getDisease() != null) {
            sql.VALUES("disease", "#{disease,jdbcType=VARCHAR}");
        }
        
        if (record.getSuggest() != null) {
            sql.VALUES("suggest", "#{suggest,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(CustomerDiet record) {
        SQL sql = new SQL();
        sql.UPDATE("customer_diet");
        
        if (record.getLoving() != null) {
            sql.SET("loving = #{loving,jdbcType=VARCHAR}");
        }
        
        if (record.getDisease() != null) {
            sql.SET("disease = #{disease,jdbcType=VARCHAR}");
        }
        
        if (record.getSuggest() != null) {
            sql.SET("suggest = #{suggest,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("customer_id = #{customerId,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}